/**
  * @file 显示部门下人员 线索显示公共资源池
  * @author hj
  * @date 2017-12-14
  */
<template>
    <div>
      <header id="header" class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title" v-text="(person.params.source == 'customer' ? '客户分配' : '线索分配') + '-选择人员'"></h1>
        <a class="mui-btn mui-btn-link mui-pull-right" @tap="saveConfirm()">确定</a>
      </header>
      <div class="mui-content">
        <div class="mui-scroll-wrapper" :style="wraCss">
          <div class="mui-scroll">
            <div class="dept_li">
              <ul v-if="person.params.source == 'clue'" class="mui-table-view">
                <li class="mui-table-view-cell">
                  <span @tap.stop="checkFn({})" class="mui-icon" :class="{'crm-circle' : person.personData.selectId, 'crm-solid-check' : !person.personData.selectId, 'checked' : !person.personData.selectId}"></span>
                  <p class="na" v-text="'公共资源池'"></p>
                </li>
              </ul>
              <div class="list_is_null" v-if="!person.personData.lists || person.personData.lists.length == 0"></div>
              <ul class="list mui-table-view" v-if="person.personData.lists && person.personData.lists.length > 0" style="margin-top: 5px;">
                <li class="mui-table-view-cell" v-for="item in person.personData.lists">
                  <!-- 自己所在的部门不能选 -->
                  <span @tap.stop="checkFn(item)" v-if="!item.isOwner" class="mui-icon" :class="{'crm-circle' : person.personData.selectId != item.id, 'crm-solid-check' : person.personData.selectId == item.id, 'checked' : person.personData.selectId == item.id}"></span>
                  <p class="na" v-text="item.name"></p>
                  <p v-text="item.belongDept" v-if="item.belongDept"></p>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
</template>
<style lang='less' rel='stylesheet.less'>

</style>
<script>
  import store from './distribution-store.js';
  var nativeApi = require('nativeApi');
  export default {
    data: function () {
      return {
        person: store.state,
        wraCss: {
          'top': '44px',
          'bottom': 0
        }
      };
    },
    methods: {
      back: function () {
        history.go(-1);
      },
      checkFn: function (item) {
        this.person.personData.selectId = item.id || '';
        this.person.personData.name = item.name || '';
      },
      saveConfirm: function () {
        store.distributionFn('person');
      }
    },
    created: function () {},
    route: {
      data: function () {
      }
    },
    ready: function () {}
  };
</script>
